using Microsoft.Practices.CompositeUI;
using System.Windows.Forms;
using System;

namespace Blue
{
    public class BlueModuleInit : ModuleInit
    {
        private WorkItem parentWorkItem;

        [ServiceDependency]
        public WorkItem ParentWorkItem
        {
            set { parentWorkItem = value; }
        }

        private Form1 form;
        public override void Load()
        {
            base.Load();
            form = new Form1();
            Form shell = (Form)parentWorkItem.Items["Shell"];
            form.MdiParent = shell;
            form.Show();

            ToolStripButton btn1 = new ToolStripButton("Show Blue Screen");
            UIExtensionSite uiExtension = parentWorkItem.UIExtensionSites["ShellToolStrip"];
            btn1.Click += new EventHandler(btn1_Click);

            uiExtension.Add<ToolStripButton>(btn1);
        }

        protected void btn1_Click(object sender, EventArgs e) 
        {
            form.BringToFront();
        }
    }
}
